<?php /* Smarty version 2.6.18, created on 2012-05-16 22:28:25
         compiled from ajax/account-basic-fullhouse.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'escape', 'ajax/account-basic-fullhouse.tpl', 14, false),)), $this); ?>
<form method="post" id="frmFullHouse" name="frmFullHouse" action="<?php echo @HOST_VFRIEND; ?>
account/basicsave" enctype="multipart/form-data">
	<input type="hidden" name="phascode" id="phascode" value="" />
    <input type="hidden" name="ptsave" id="ptsave" value="<?php echo $this->_tpl_vars['intType']; ?>
" />
    <div class="editForm">  	
    	<?php if ($this->_tpl_vars['objUser']->uname_verify): ?>
        	<p>Username của bạn là <strong><?php echo $this->_tpl_vars['AppUI']->username; ?>
</strong></p>
            <p>Mọi người có thể xem trang cá nhân của bạn qua liên kết:</p>
            <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="<?php echo @HOST_VFRIEND; ?>
<?php echo $this->_tpl_vars['AppUI']->username; ?>
"><?php echo @HOST_VFRIEND; ?>
<strong><?php echo $this->_tpl_vars['AppUI']->username; ?>
</strong></a></p>
             <input type="button" value="Đóng" class="btn tMargin10 bMargin10" onclick="javascript:basicClose('<?php echo $this->_tpl_vars['strView']; ?>
','<?php echo $this->_tpl_vars['strEdit']; ?>
')" />
        <?php else: ?>
            <p>Bạn chỉ có thể áp dụng việc thay đổi Username để tạo Url friendly của Full-house một lần duy nhất.</p>
            <div class="userInput">
                <label>Username:</label>
                <input type="text" value="<?php if (isset ( $_SESSION['st_username'] )): ?><?php echo ((is_array($_tmp=$_SESSION['st_username'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
<?php else: ?><?php echo ((is_array($_tmp=$this->_tpl_vars['objUser']->username)) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
<?php endif; ?>" id="pusername" name="pusername" maxlength="30" class="text clearIt" />	
            </div>
            <div class="userInput">
                <label>Mật khẩu <?php echo @DOMAIN_NAME; ?>
 của bạn:</label>
                <input type="password" value="" id="ppassword" name="ppassword" maxlength="30" class="text clearIt" />	
            </div>
            <div class="userInput">
                <input type="submit" value="Thay đổi" class="btn" />
                <input type="button" value="Hủy" class="btn" onclick="javascript:basicClose('<?php echo $this->_tpl_vars['strView']; ?>
','<?php echo $this->_tpl_vars['strEdit']; ?>
')" />
            </div>
        <?php endif; ?>
   	</div>
</form>
<?php echo '
<script type="text/javascript" language="javascript">
	$(document).ready(function(){
		$("#frmFullHouse").validate({				
			errorClass		: \'errorMessage\',
			errorElement	: \'span\',
			onfocusout		: false,
			onkeyup			: false,
			rules: {	
				pusername: {
					required			: true,
					rangelength			: [5,30],
					validUsername		: true,
					isExistUsername		: true					
				},
				ppassword:{
					passwordValidate	: true
				}
			},
			messages: {	
				pusername: {
					required			: username_required,
					rangelength			: username_range,
					validUsername		: username_format,
					isExistUsername		: username_validate
					
				},
				ppassword:{
					passwordValidate	: password_invalid
				}
			},		
			errorPlacement: function(label, element) {			
				var id = element.attr(\'id\');			
				label.insertAfter($(\'#\' + id));			
			},
			submitHandler: function(form) {				
				form.submit();
			}
		});	
		$.validator.addMethod(\'validUsername\', function(){
			var strUsername = $(\'#pusername\').val();
			return validateUsername(strUsername);
		});
		$.validator.addMethod(\'validUsername\', function(){
			var result 			= true;
			var strUsername		= $(\'#pusername\').val();		
			var strUrl 			= HOST_VFRIEND + \'valid/isvalidusername\';			
			$.ajax({
				cache	: false,
				async	: false,
				type	: \'POST\',
				data	: \'username=\' + strUsername,
				url		: strUrl,
				success	: function(response) {
					result = (response == 1) ? true : false;
				}
			});
			return result;		
		});
		$.validator.addMethod(\'passwordValidate\', function(){
			var result 			= true;
			var strPassword		= $(\'#ppassword\').val();
			var strHasPassword	= MD5(MD5(strGeneralCode) + MD5(strPassword));				
			var strUrl 			= HOST_VFRIEND + \'valid/isvalidpassword\';
			$(\'#ppassword\').val(\'\');
			$(\'#phascode\').val(strHasPassword);
			$.ajax({
				cache	: false,
				async	: false,
				type	: \'POST\',
				data	: \'password=\' + strHasPassword,
				url		: strUrl,
				success	: function(response) {
					result = (response == 1) ? true : false;
				}
			});
			return result;								   
		});		
	});
</script>
'; ?>